<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>


<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${applicationScope.KEY_SITE_NAME}</title>

<!-- for dreamweaver -->
<link href="../../resources/css/intstyle.css" rel="stylesheet"
	type="text/css" />
<link href="../../resources/css/jquery-ui.css" rel="stylesheet"
	type="text/css" />
<link href="../../resources/css/ichecker/square/blue.css"
	rel="stylesheet" type="text/css" />
<link
	href="../../resources/css/timepicker/jquery-ui-timepicker-addon.css"
	rel="stylesheet" type="text/css" />
<link href="../../resources/css/combobox.css" rel="stylesheet"
	type="text/css" />
<link href="../../resources/css/jquery.dataTables.css" rel="stylesheet"
	type="text/css" />
	
	
<link href="resources/css/intstyle.css" rel="stylesheet" type="text/css" />
<link href="resources/css/jquery-ui.css" rel="stylesheet"
	type="text/css" />
<link href="resources/css/ichecker/square/blue.css" rel="stylesheet"
	type="text/css" />
<link href="resources/css/timepicker/jquery-ui-timepicker-addon.css"
	rel="stylesheet" type="text/css" />
<link href="resources/css/combobox.css" rel="stylesheet" type="text/css" />
<link href="resources/css/jquery.dataTables.css" rel="stylesheet"
	type="text/css" />



<script type="text/javascript" src="resources/scripts/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="resources/scripts/jquery-ui.custom.js"></script>
<script type="text/javascript" src="resources/scripts/jquery.icheck.js"></script>
<script type="text/javascript"
	src="resources/scripts/timepicker/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript"
	src="resources/scripts/timepicker/i18n/jquery-ui-timepicker-ja.js"></script>
<script type="text/javascript"
	src="resources/scripts/i18n/jquery.ui.datepicker-ja.js"></script>
<script type="text/javascript" src="resources/scripts/combobox.js"></script>
<script type="text/javascript"
	src="resources/scripts/jquery.dataTables.js"></script>
<script type="text/javascript" src="resources/scripts/jquery.blockUI.js"></script>

<!-- for dreamweaver -->
<script type="text/javascript"
	src="../../resources/scripts/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="../../resources/scripts/jquery-ui.custom.js"></script>
<script type="text/javascript"
	src="../../resources/scripts/jquery.icheck.js"></script>
<script type="text/javascript"
	src="../../resources/scripts/timepicker/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript"
	src="../../resources/scripts/timepicker/i18n/jquery-ui-timepicker-ja.js"></script>
<script type="text/javascript"
	src="../../resources/scripts/i18n/jquery.ui.datepicker-ja.js"></script>
<script type="text/javascript" src="../../resources/scripts/combobox.js"></script>
<script type="text/javascript" src="../../resources/scripts/jquery.blockUI.js"></script>

<script>
	$(document).ready(function() {
		$('input').iCheck({
			checkboxClass : 'icheckbox_square-blue',
			radioClass : 'iradio_square-blue',
			increaseArea : '20%'
		});
	});

	$(function() {
		$('#tradedate').datetimepicker();
	});

	$(function() {
		$("#combobox").combobox();
	});

	$(function() {
		$("#resizable").resizable({
			handles : "se"
		});
	});
	$(function() {
		/* $("input[type=submit],input[type=reset],input[type=button],button").button().click(function(event) {
			event.preventDefault();
		}); */
		
		$("input[type=submit],input[type=reset],input[type=button],button").button();
	});

	$(document).ready(function() {

		$('#usertable').dataTable({
			"sPaginationType" : "full_numbers",
			"bSort" : false
		});
		$('#usertable2').dataTable();
	});

</script>  

<!--[if lte IE 7]>
<style>
.content { margin-right: -1px; } /* 此 1px 负边距可以放置在此布局中的任何列中，且具有相同的校正效果。 */
ul.nav a { zoom: 1; }  /* 缩放属性将为 IE 提供其需要的 hasLayout 触发器，用于校正链接之间的额外空白 */
</style>
<![endif]-->
</head>

<body>

	<div class="container">
		<%@include file="../header.jsp"%>
		<%@include file="sidebar.jsp"%>
		<div class="content">
			<div class="subnav">网站设置&gt;&gt;关键字设置</div>

			<c:if test="${not empty errors}">

				<div class="ui-state-error ui-corner-all" style="margin: 15px;">
					<p>
						<span class="ui-icon ui-icon-alert"
							style="float: left; margin-right: .3em;"></span> <strong
							style="color: #cd0a0a;">Alert:</strong>
					</p>
					<p style="color: #cd0a0a;">Sample ui-state-error style.</p>
					<p style="color: #cd0a0a;">Sample ui-state-error style.</p>
				</div>

			</c:if>
			<div class="box">

				<div class="box" style="border: none;">
					<h2>
						<spring:message code="Label.siteinfo.main" />
					</h2>

					<form id="form1" name="form1" method="post" action="">

						<fieldset>
							<div class="formfield">

								<div class="formLabel">
									<label for="sitename"><spring:message
											code="Label.siteinfo.name" /></label>
								</div>
								<div class="forminput">
									<input type="text" id="sitename" name="KEY_SITE_NAME"
										class="text ui-widget-content ui-corner-all"
										value="${settings.KEY_SITE_NAME}" />
								</div>

							</div>

							<div class="formfield">
								<div class="formLabel">
									<label for="copyright"><spring:message
											code="Label.siteinfo.copyright" /></label>
								</div>
								<div class="forminput">
									<input type="text" id="copyright" name="KEY_COPYRIGHT"
										class="text ui-widget-content ui-corner-all"
										value="${settings.KEY_COPYRIGHT}" />
								</div>
							</div>


							<div class="formfield">

								<div class="formLabel" style="vertical-align: top;">
									<label for="keywords"><spring:message
											code="Label.siteinfo.keywords" /></label>
								</div>
								<div class="forminput">
									<textarea id="keywords" name="KEY_KEYWORDS" cols="65" rows="8"
										class="text ui-widget-content ui-corner-all">${settings.KEY_KEYWORDS}</textarea>
								</div>
							</div>

							<div class="formfield">

								<div class="formLabel" style="vertical-align: top;">
									<label for="description"><spring:message
											code="Label.siteinfo.description" /></label>
								</div>
								<div class="forminput">
									<textarea id="description" name="KEY_DESC" cols="65" rows="8"
										class="text ui-widget-content ui-corner-all">${settings.KEY_DESC}</textarea>
								</div>
							</div>

							<div class="formfield">
								<div class="formLabel">
									<label for="email"><spring:message
											code="Label.siteinfo.email" /></label>
								</div>
								<div class="forminput">
									<input type="text" id="email" name="KEY_EMAIL"
										class="text ui-widget-content ui-corner-all"
										value="${settings.KEY_EMAIL}" />
								</div>
							</div>

							<div class="formfield">
								<div class="formLabel">
									<label for="mailpassword"><spring:message
											code="Label.siteinfo.mail.password" /></label>
								</div>
								<div class="forminput">
									<input type="password" id="mailpassword" name="KEY_MAIL_PSW"
										class="text ui-widget-content ui-corner-all"
										value="${settings.KEY_MAIL_PSW}" />
								</div>
							</div>

							<div class="formfield">
								<div class="formLabel">
									<label for="mailserver"><spring:message
											code="Label.siteinfo.mail.server" /></label>
								</div>
								<div class="forminput">
									<input type="text" id="mailserver" name="KEY_MAIL_SERVER"
										class="text ui-widget-content ui-corner-all"
										value="${settings.KEY_MAIL_SERVER}" />
								</div>
							</div>
							<div class="forminput">
								<button type="button" id="submitbtn" onclick="updateSiteInfo()"><spring:message code='Label.common.save'/> </button>
								<button type="reset" id="reset"><spring:message code='Label.common.reset'/></button>
							</div>

						</fieldset>
					</form>
				</div>
			</div>

			<!-- end .content -->
		</div>
		<div class="clearfloat" />
		<%@include file="../footer.jsp"%>
		<!-- end .container -->
	</div>
	
<script type="text/javascript">
function updateSiteInfo() {

	
	if($("#email").val()==""){
		$("#email").parent().addClass("redinput");
		$("#email").focus();		
		return false;
	}else{
		$("#email").parent().removeClass("redinput");
	}
	if($("#mailpassword").val()==""){
		$("#mailpassword").parent().addClass("redinput");
		$("#mailpassword").focus();		
		return false;
	}else{
		$("#mailpassword").parent().removeClass("redinput");
	}
	
	if($("#mailserver").val()==""){
		$("#mailserver").parent().addClass("redinput");
		$("#mailserver").focus();		
		return false;
	}else{
		$("#mailserver").parent().removeClass("redinput");
	}

	$.blockUI({
		message:'<img src="resources/images/loading.gif" />',
		theme :true,
		draggable:false,
		fadeIn:  100,
		fadeOut: 10,
		themedCSS: { 
	        height: '0',
	        padding: '0',
	        border: 'none',
	        top:    '45%', 
	        left:   '45%',
	    }
		
	});
	
 	$.post( "admin/site/update",			
			$("#form1").serialize(),			
			function(obj, html) {
				$.unblockUI();
				$("#saveOk").dialog( "open" );
			}
	);
}



$("#saveOk").dialog({
	modal: true,
	autoOpen: false,
	width: 400,
	show: {
        effect: 'fade',
        duration: 200
    },
    hide: {
        effect: 'fade',
        duration: 100
    },
	open: function(event, ui) {$(".ui-dialog-titlebar").show();},
	buttons: [
		{
			text: "Ok",
			click: function() {
				$(this).dialog("close");
			}
		}
	]
});

</script>

</body>
</html>